#define  _CRT_SECURE_NO_WARNINGS 1

#include "Sort.h"

void TestOP()
{
	int n = 100000;

	int* arr1 = (int*)malloc(n * sizeof(int));
	int* arr2 = (int*)malloc(n * sizeof(int));
	int* arr3 = (int*)malloc(n * sizeof(int));
	int* arr4 = (int*)malloc(n * sizeof(int));
	int* arr5 = (int*)malloc(n * sizeof(int));
	int* arr6 = (int*)malloc(n * sizeof(int));
	int* arr7 = (int*)malloc(n * sizeof(int));

	for (int i = 0; i < n; ++i)
	{
		arr1[i] = rand() + i;
		arr2[i] = arr1[i];
		arr3[i] = arr1[i];
		arr4[i] = arr1[i];
		arr5[i] = arr1[i];
		arr6[i] = arr1[i];
		arr7[i] = arr1[i];
	}

	int begin = 0, end = 0;

	begin = clock();
	InsertSort(arr1, n);
	end = clock();
	printf("InsertSort: %d\n", end - begin);

	begin = clock();
	BubbleSort(arr2, n);
	end = clock();
	printf("BubbleSort: %d\n", end - begin);

	begin = clock();
	SelectSort(arr3, n);
	end = clock();
	printf("SelectSort: %d\n", end - begin);

	begin = clock();
	ShellSort(arr4, n);
	end = clock();
	printf("ShellSort: %d\n", end - begin);

	begin = clock();
	HeapSort(arr5, n);
	end = clock();
	printf("HeapSort: %d\n", end - begin);

	begin = clock();
	QuickSort1(arr6, 0, n - 1);
	end = clock();
	printf("QuickSort: %d\n", end - begin);

	begin = clock();
	MergeSort(arr7, n);
	end = clock();
	printf("MergeSort: %d\n", end - begin);

}


int main()
{
	TestOP();

	return 0;
}